<template>
  <div class="user">
    <pageSearch
      :searchFormConfig="searchFormConfig"
      @queryBtnClick="handleSearch"
      @resetBtnClick="handleReset"
    />
    <pageContent
      ref="pageContentRef"
      :contentTableConfig="contentTableConfig"
      pageName="department"
    >
      <template #createAt="scope">
        <span>{{ $filters.formatTime(scope.row.createAt) }}</span>
      </template>
      <template #updateAt="scope">
        <span>{{ $filters.formatTime(scope.row.updateAt) }}</span>
      </template>
    </pageContent>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

import { searchFormConfig } from './config/search.config'
import { contentTableConfig } from './config/content.config'

import pageSearch from '@/components/page-search'
import pageContent from '@/components/page-content'

import { usePageSearch } from '@/hooks/usePageSearch'

export default defineComponent({
  name: 'user',
  components: { pageSearch, pageContent },
  setup() {
    const [pageContentRef, handleSearch, handleReset] = usePageSearch()
    return {
      searchFormConfig,
      contentTableConfig,
      pageContentRef,
      handleSearch,
      handleReset
    }
  }
})
</script>

<style scoped lang="less"></style>
